# -*- coding: utf-8 -*-
"""
Created on Wed Dec 20 10:27:19 2017

@author: Luther
"""

import os
import pandas as pd

path_name = input("请输入重命名规则文件的位置：")
path = input("请输入待重命名文件的目录：")

name = pd.read_csv(path_name)

for i in range(len(name)):
    try:
        path_old = os.path.join(path, name.old[i])
        path_new = os.path.join(path, name.new[i])
        os.rename(path_old, path_new)
    except:
        print("文件{:}-->{:}命名失败".format(name.old[i], name.new[i]))

print("重命名成功！")
